from rest_framework.viewsets import GenericViewSet

from apps.models import Notice
from apps.serializers.notice import NoticeSerializer
from apps.utils.common_response import APIResponse


class NoticeListView(GenericViewSet):
    def list(self,request):
        notices = Notice.objects.all().order_by('-create_time')
        serializer = NoticeSerializer(notices, many=True)
        return APIResponse(msg='查询成功', data=serializer.data)
